package com.neutech.code.user;


import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

public class UserDaoImpl implements UsersDao{
    @Override
    public void saveUsers(List<Users> list) {
        String sql = "insert into users values";
        for(int i=0;i<list.size();i++){
            Users user=list.get(i);
            PreparedStatement pstmt=null;
            try {
                pstmt=BaseDao.getConn().prepareStatement("insert into users values (?,?,?,?,?)");
                pstmt.setString(1,user.getName());
                pstmt.setString(2,user.getPwd());
                pstmt.setString(3,user.getEmail());
                pstmt.setString(4,user.getBirthday());
                pstmt.setInt(5,user.getMoney());
                pstmt.executeUpdate();
            } catch (Exception e) {
                e.printStackTrace();
            }finally {
                BaseDao.close(ResultSet.pstmt);

            }
        }
    }

    @Override
    public void editUsers(String name) {

    }

    @Override
    public void removeUsers(String name) {

    }

    @Override
    public List<Users> listUsers() {
        return null;
    }

    @Override
    public void transfer(Users user1, Users user2, int money) {

    }

//    @Override
//    public void transfer(Users user1, Users user2, Users user3) {
//
//    }
}
